#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int n;
int shu[1005][1005];
bool except;
int tt[1005];
bool flag[1005];
int cnt;
int sum;

void checksum()
{
	int i;
	cnt =0;
	for (i=1; i<=n; ++i)
		cnt += shu[i][ tt[i] ];
	if (cnt != sum) except = true;
}

void di(int pt)
{
	int i;
	if (except) return; 
	if (pt > n)
	{
		checksum();
		return;
	}
	while (1)
	{
		i = rand()%n+1;
		if (flag[i] == false)
		{
			flag[i] = true;
			tt[pt] = i;
			di(pt+1);
			flag[i] = false;
			break;
		}
	}
}


int main()
{
	int i, j;
	
	while( scanf("%d", &n))
	{
		if (n==0) break;
		except = false;
		for (i=1; i<=n; ++i)
			for (j=1; j<=n; ++j)
				scanf("%d", &shu[i][j]);
		for (i=1, sum=0; i<=n; ++i)
			sum += shu[i][i];
		cnt = 0;
		for (i=1; i<=1000 && !except; ++i)
		{
			memset(flag, 0, sizeof(flag));
			di(1);		
		}
		if (except) printf("not homogeneous\n");
		else printf("homogeneous\n");
	}
	return 0;
}